package com.ly.heart.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ly.heart.domain.KingInventoryMaterialEntity;
import com.ly.heart.domain.dto.KingInventoryQueryDto;
import com.ly.heart.domain.dto.KingOrderMaterialQueryDto;
import com.ly.heart.domain.dto.KingReceiveNoticeMaterialQueryDto;
import com.ly.heart.domain.vo.KingPurchaseInventoryVo;
import com.ly.heart.domain.vo.KingSaleOutInventoryVo;
import com.ly.heart.domain.vo.OrderSumResult;

/**
 * 金蝶-入库/出库明细Mapper接口
 * @author cxl
 * @date 2024-07-13
 */
public interface KingInventoryMaterialMapper extends BaseMapper<KingInventoryMaterialEntity> {

    /**
     * 查询采购入库单物料明细列表
     * @param queryDto
     * @return
     */
    List<KingPurchaseInventoryVo> getPurchaseInventoryList (KingInventoryQueryDto queryDto);

    /**
     * 查询总数
     * @param queryDto
     * @return
     */
    Integer queryTotalCount (KingInventoryQueryDto queryDto);

    /**
     * 查询金蝶-入库/出库明细
     * @param id 金蝶-入库/出库明细ID
     * @return 金蝶-入库/出库明细
     */
    public KingInventoryMaterialEntity selectKingInventoryMaterialEntityById (String id);

    /**
     * 查询金蝶-入库/出库明细列表
     * @param kingInventoryMaterialEntity 金蝶-入库/出库明细
     * @return 金蝶-入库/出库明细集合
     */
    public List<KingInventoryMaterialEntity> selectKingInventoryMaterialEntityList (KingInventoryMaterialEntity kingInventoryMaterialEntity);

    /**
     * 新增金蝶-入库/出库明细
     * @param kingInventoryMaterialEntity 金蝶-入库/出库明细
     * @return 结果
     */
    public int insertKingInventoryMaterialEntity (KingInventoryMaterialEntity kingInventoryMaterialEntity);

    /**
     * 修改金蝶-入库/出库明细
     * @param kingInventoryMaterialEntity 金蝶-入库/出库明细
     * @return 结果
     */
    public int updateKingInventoryMaterialEntity (KingInventoryMaterialEntity kingInventoryMaterialEntity);

    /**
     * 删除金蝶-入库/出库明细
     * @param id 金蝶-入库/出库明细ID
     * @return 结果
     */
    public int deleteKingInventoryMaterialEntityById (String id);

    /**
     * 批量删除金蝶-入库/出库明细
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteKingInventoryMaterialEntityByIds (String[] ids);

    /**
     * 根据采购订单id和物料id查询集合
     */
    public List<KingInventoryMaterialEntity> selectMaterialByOrderIdAndMaterialId (KingOrderMaterialQueryDto queryDto);

    /**
     * 根据采购订单id和物料id查询总数
     * @param queryDto
     * @return
     */
    OrderSumResult selectSumReceiptsNum (KingOrderMaterialQueryDto queryDto);

    /**
     * 根据收料通知单id和物料id查询总数
     * @param queryDto
     * @return
     */
    OrderSumResult selectSumReceiptsNumByReceiveNotice (KingReceiveNoticeMaterialQueryDto queryDto);

    /**
     * 查询销售出库单物料明细列表
     * @param queryDto
     * @return
     */
    List<KingSaleOutInventoryVo> getSaleOutInventoryList (KingInventoryQueryDto queryDto);
    Integer getSaleOutInventoryCount (KingInventoryQueryDto queryDto);


    /**
     * 通过物料、批号、类型=出库、出库时间查询本月前的出库记录
     * @param kingInventoryMaterialEntity
     * @return
     */
    List<KingInventoryMaterialEntity> queryListByCostAdjustment (KingInventoryMaterialEntity kingInventoryMaterialEntity);


    /**
     * 通过出库单Id查询销售出库单明细列表
     * @param inventoryId
     * @return
     */
    List<KingInventoryMaterialEntity> querySaleInventoryList (String inventoryId);

}
